window._MSHE ={

    _TJARR:null,

    showUi:function(parentNode,param){

        var uiObj = _GRM.getNodeObj('selectHelp');
        var mainLabel = uiObj.node;

        if(uiObj.isnew){
            mainLabel.getChildByName('mask').on(cc.Node.EventType.TOUCH_START, function(){
                _GRM.putNode(this);
            }, mainLabel);
            _MSHE.initButton(mainLabel);
        }

        parentNode.addChild(mainLabel);

        return mainLabel;

    },

    hasPlaceOpen:function(roleplaces){
        if(roleplaces.length>0){
            for(var i=0;i<roleplaces.length;i++){
                if(_GAMEDATAHELPER.isChapterOpen(roleplaces[i])){
                    return true;
                }
            }
        }
        return false;
    },

    getTjArr:function(){

        _MSHE._TJARR = [];

        for(var key in _NPC){
                if(_MRMN.canMeet(key)&&!_GAMEDATAHELPER.hasNpcTj(key)){
                    var roleplace = _NPCDL.getNpcPlace(key);
                    if(_MSHE.hasPlaceOpen(roleplace)){

                        _MSHE._TJARR.push({value:key});

                    }
                }
           }
    },

    initButton:function(mainLabel){

        var tjBtn = mainLabel.getChildByName('tjBtn');

        tjBtn.on(cc.Node.EventType.TOUCH_START, function(){
           
            _MSHE.getTjArr();

           if(_MSHE._TJARR.length>0){

                _GRM.putNode(this);

                _NPCDL.initUi(_MAP.node,{sence:_STYPE._FIGHTSENCE,
                    roleArr:_MSHE._TJARR,
                    roleIndex:0
                });
                
                return;

           }else{

                _TIPS.showMessage('未发现可以完成的图鉴(完成主线解锁新地图可以增加可完成图鉴)');

           }

        }, mainLabel);

    }
    
}